package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.HospitalDiseaseMapper;
import com.ruoyi.web.domain.HospitalDisease;
import com.ruoyi.web.service.IHospitalDiseaseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 医院疾病关联 Service业务层处理
 * 
 * @author why
 * @date 2025-05-13
 */
@Service
public class HospitalDiseaseServiceImpl implements IHospitalDiseaseService 
{
    @Autowired
    private HospitalDiseaseMapper hospitalDiseaseMapper;

    /**
     * 查询医院疾病关联
     * 
     * @param id 医院疾病关联 主键
     * @return 医院疾病关联
     */
    @Override
    public HospitalDisease selectHospitalDiseaseById(Long id)
    {
        return hospitalDiseaseMapper.selectHospitalDiseaseById(id);
    }

    /**
     * 查询医院疾病关联 列表
     * 
     * @param hospitalDisease 医院疾病关联
     * @return 医院疾病关联
     */
    @Override
    public List<HospitalDisease> selectHospitalDiseaseList(HospitalDisease hospitalDisease)
    {
        return hospitalDiseaseMapper.selectHospitalDiseaseList(hospitalDisease);
    }

    /**
     * 新增医院疾病关联
     * 
     * @param hospitalDisease 医院疾病关联
     * @return 结果
     */
    @Override
    public int insertHospitalDisease(HospitalDisease hospitalDisease)
    {
        hospitalDisease.setCreateTime(DateUtils.getNowDate());
        hospitalDisease.setCreateBy(ShiroUtils.getSysUser().getLoginName());
        hospitalDisease.setCreateName(ShiroUtils.getSysUser().getUserName());

        hospitalDisease.setUpdateTime(DateUtils.getNowDate());
        hospitalDisease.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
        hospitalDisease.setUpdateName(ShiroUtils.getSysUser().getUserName());
        return hospitalDiseaseMapper.insertHospitalDisease(hospitalDisease);
    }

    /**
     * 修改医院疾病关联
     * 
     * @param hospitalDisease 医院疾病关联
     * @return 结果
     */
    @Override
    public int updateHospitalDisease(HospitalDisease hospitalDisease)
    {
        hospitalDisease.setUpdateTime(DateUtils.getNowDate());
        hospitalDisease.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
        hospitalDisease.setUpdateName(ShiroUtils.getSysUser().getUserName());
        return hospitalDiseaseMapper.updateHospitalDisease(hospitalDisease);
    }

    /**
     * 批量删除医院疾病关联
     * 
     * @param ids 需要删除的医院疾病关联 主键
     * @return 结果
     */
    @Override
    public int deleteHospitalDiseaseByIds(String ids)
    {
        return hospitalDiseaseMapper.deleteHospitalDiseaseByIds(Convert.toStrArray(ids),ShiroUtils.getSysUser().getLoginName());
    }

    /**
     * 删除医院疾病关联 信息
     * 
     * @param id 医院疾病关联 主键
     * @return 结果
     */
    @Override
    public int deleteHospitalDiseaseById(Long id)
    {
        return hospitalDiseaseMapper.deleteHospitalDiseaseById(id,ShiroUtils.getSysUser().getLoginName());
    }
}
